package com.robot.admin.client;

import com.robot.admin.client.impl.GoodsClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Map;

/**
 * @author lin
 */
@Component
@FeignClient(value = "robot-goods", fallback = GoodsClientImpl.class)
public interface GoodsClient {
    /**
     * 分页+多条件查询GoodsCategory
     *
     * @param searchMap 查询条件封装
     * @param page      页码
     * @param size      页大小
     * @return 分页结果
     */
    @RequestMapping(value = "category/third/findGoodsCategoryBySearch/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindGoodsCategoryBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 全部GoodsCategory
     *
     * @return
     */
    @RequestMapping(value = "category/third/findGoodsCategory", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindGoodsCategory();

    /**
     * 根据ID查询GoodsCategory
     *
     * @param id ID
     * @return
     */
    @RequestMapping(value = "category/third/findGoodsCategoryById/{id}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindGoodsCategoryById(@PathVariable String id);

    /**
     * 通过name查询GoodsCategory
     *
     * @param name
     * @return
     */
    @RequestMapping(value = "category/third/findGoodsCategoryByName/{name}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindGoodsCategoryByName(@PathVariable String name);

    /**
     * 增加GoodsCategory
     *
     * @param goodsCategory
     */
    @RequestMapping(value = "category/third/addGoodsCategoryByGoodsCategory", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public void thirdAddGoodsCategoryByGoodsCategory(@RequestBody String goodsCategory);

    /**
     * 修改GoodsCategory
     *
     * @param goodsCategory
     */
    @RequestMapping(value = "category/third/updateGoodsCategoryByGoodsCategory", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    public void thirdUpdateGoodsCategoryByGoodsCategory(@RequestBody String goodsCategory);

    /**
     * 删除GoodsCategory
     *
     * @param id
     */
    @RequestMapping(value = "category/third/deleteGoodsCategoryById/{id}", method = RequestMethod.DELETE, produces = "application/json; charset=utf-8")
    public void thirdDeleteGoodsCategoryById(@PathVariable String id);


    /**
     * 分页+多条件查询
     *
     * @param searchMap 查询条件封装
     * @param page      页码
     * @param size      页大小
     * @return 分页结果
     */
    @RequestMapping(value = "goods/third/findGoodsBySearch/{page}/{size}", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public String thirdFindGoodsBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 通过categoryId查询goods列表并分页
     *
     * @param categoryId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "goods/third/findGoodsByCategoryId/{categoryId}/{page}/{size}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindGoodsByCategoryId(@PathVariable String categoryId, @PathVariable int page, @PathVariable int size);

    /**
     * 根据ID查询
     *
     * @param id ID
     * @return
     */
    @RequestMapping(value = "goods/third/findGoodsById/{id}", method = RequestMethod.GET, produces = "application/json; charset=utf-8")
    public String thirdFindGoodsById(@PathVariable String id);

    /**
     * 增加
     *
     * @param goods
     */
    @RequestMapping(value = "goods/third/addGoodsByGoods", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
    public void thirdAddGoodsByGoods(@RequestBody String goods);

    /**
     * 修改
     *
     * @param goods
     */
    @RequestMapping(value = "goods/third/updateGoodsByGoods", method = RequestMethod.PUT, produces = "application/json; charset=utf-8")
    public void thirdUpdateGoodsByGoods(@RequestBody String goods);

    /**
     * 删除
     *
     * @param id
     */
    @RequestMapping(value = "goods/third/deleteGoodsById/{id}", method = RequestMethod.DELETE, produces = "application/json; charset=utf-8")
    public void thirdDeleteGoodsById(@PathVariable String id);
}
